#include <main.h>

#define SCREEN_WIDTH        (1024)
#define SCREEN_HEIGHT       (600)

int randomInt(int min, int max)
{
	return min + rand() % (max - min + 1);
}

static void random_rect(void)
{
	struct surface_t * screen;
    struct rect_t rect;
	u32_t c;

	screen = s5pv210_screen_surface();
	s5pv210_screen_swap();
	s5pv210_screen_flush();

    while (1)
	{
    	rect.x = randomInt(0, SCREEN_WIDTH - 1);
    	rect.y = randomInt(0, SCREEN_HEIGHT - 1);
    	rect.w = randomInt(1, SCREEN_WIDTH/4);
    	rect.h = randomInt(1, SCREEN_HEIGHT/4);
    	c = randomInt(0, 0x00ffffff);

		surface_fill(screen, &rect, c, BLEND_MODE_REPLACE);
	}
}

int tester_framebuffer_random_rect(int argc, char * argv[])
{
	random_rect();
	return 0;
}
